﻿#ifndef MINIFLOATINGWINDOW_H
#define MINIFLOATINGWINDOW_H

#include <QtGui>
#include <QWidget>
#include <Windows.h>

namespace GenerateReport
{   
    class MiniFloatingWindow : public QWidget
    {
        Q_OBJECT
    private:
        QPoint m_CurrentPos;
        QPixmap m_Pixmap;
    protected:
        void mousePressEvent(QMouseEvent* event);
        void mouseMoveEvent(QMouseEvent* event);
        void paintEvent(QPaintEvent* event);
        void enterEvent(QEvent* event);
        void leaveEvent(QEvent* event);
        void mouseDoubleClickEvent(QMouseEvent* event);
    public:
        MiniFloatingWindow(QWidget* parent = 0);
        void SetPixmap(const QPixmap& pixmap);
        /// @brief 设置限制需要限制在哪个窗口范围内
        void setMainWindow(QWidget* pMainWgt);
        /// @brief 限制悬浮窗移动范围，计算并返回悬浮窗终点坐标
        QPoint getFixGlobalPos(QPoint mouseGPos);

    private:
        QWidget* m_MainWindow{nullptr};
    };

}

#endif // T_CREATENEWREPORTWIDGET_H
